package com.xayy.mgt.service.impl;

import cn.kawins.base.result.CheckResult;
import cn.kawins.mybatis.base.BaseServiceImpl;
import com.github.pagehelper.PageInfo;
import com.github.pagehelper.page.PageMethod;
import com.xayy.mgt.model.dto.PageDto;
import com.xayy.mgt.model.xinwangmodel.AssessHistory;
import com.xayy.mgt.service.AssessHistoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import tk.mybatis.mapper.entity.Example;

import java.util.List;

/**
 * 星座健康态势评估历史
 * @author plq
 */
@Service
@Slf4j
public class AssessHistoryServiceImpl extends BaseServiceImpl<AssessHistory> implements AssessHistoryService {


    @Override
    public CheckResult<Object> getAssessHistory(PageDto pageDto) {
        PageMethod.startPage(pageDto.getPage(), pageDto.getSize());
        Example example = new Example(AssessHistory.class);
        example.orderBy("assessTime").desc();
        List<AssessHistory> assessHistories = selectByExample(example);
        PageInfo<AssessHistory> assessHistoryPageInfo = new PageInfo<>(assessHistories);
        return CheckResult.success(assessHistoryPageInfo);
    }
}
